package com.kx.kxblog.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.persistence.*;

@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Accessors(chain = true)
@Table(indexes = @Index(columnList = "userId"))
@ApiModel(value = "Theme", description = "主题")
@AllArgsConstructor
@NoArgsConstructor
public class Theme extends AbstractEntity{
    @Column(length = 32)
    @ApiModelProperty(value = "名称")
    private String name;

    @Column(length = 64)
    @ApiModelProperty(value = "简介")
    private String describe;


    @Column(length = 16)
    @ApiModelProperty(value = "版本")
    private String version;

    @Column
    @ApiModelProperty(value = "是否共享")
    private boolean shared;

    @Column(nullable = false, unique = true, updatable = false)
    @ApiModelProperty(value = "用户id", required = true)
    private Integer userId;

    @OneToOne
    @JoinColumn(name = "userId", insertable = false, updatable = false)
    @ApiModelProperty(value = "用户")
    private User user;
}
